Imaging apparatus having settable focus detection areas and method for controlling the same

ABSTRACT

An imaging apparatus includes an image sensor including a pair of photoelectric conversion units for each of a plurality of microlenses arranged in a matrix of rows and columns, and capable of reading a signal from each row. According to a size of a focus detection area, a camera control unit regularly sets on the image sensor a first area having as many rows in which signals for use in focus detection are read from the image sensor as a first predetermined number of rows, and a second area having as many rows in which signals for use in focus detection are not read as a second predetermined number of rows.

BACKGROUND OF THE INVENTION Field of Invention

The present invention relates to focus detection control of an imagingapparatus, and also relates to a method for controlling an imagingapparatus.

Description of Related Art

A technique for performing imaging plane phase difference focusdetection using signals output from an image sensor is known. Thepublication of Japanese Patent Application Laid-Open No. 2016-015695 (athird exemplary embodiment therein) discusses an example of a techniquefor performing imaging plane phase difference focus detection. In thistechnique, a predetermined number of rows, in which signals for use infocus detection, are read and a predetermined number of rows in whichsignals for use in focus detection are not read, and signals for imagingare read are mixed together in a column direction, and the signals arealternately read. This limits the number of rows in which signals foruse in focus detection are read. Thus, it is possible to shorten thetime required to read one frame from the image sensor.

Further, the publication of Japanese Patent Application Laid-Open No.2012-155095 discusses a case where an area where a desired object isbrought into focus is set, and signals for use in focus detection areoutput from pixel portions of an image sensor that correspond to thisarea. From pixel portions of the image sensor that do not correspond tothe area where a desired object is brought into focus, signals for usein focus detection are not read, and signals for use in generating animage to be displayed and recorded are read (output). Consequently, inthis case too, it is possible to shorten the time required to read oneframe from the image sensor.

In the publication of Japanese Patent Application Laid-Open No.2016-015695, however, if a main object does not overlap an area wheresignals for use in focus detection are read, it is not possible toperform focus detection. FIG. 12 is a diagram illustrating the abovesituation found by the inventor where shaded areas 1502 are areas wheresignals for use in focus detection are read, and a focus detection area1500 is an area where an object 1501 is desired to be brought intofocus.

SUMMARY OF THE INVENTION

The various aspects of the present invention disclose an imagingapparatus less likely to cause the deficiencies described above, and amethod for controlling an imaging apparatus.

According to an aspect of the present invention, an imaging apparatusincludes an image sensor, a first setting unit configured to set a sizeof a focus detection area, and a second setting unit configured to seton the image sensor a plurality of first areas for reading a focusdetection signal from the image sensor and a plurality of second areaswhere the focus detection signal is not read, by arranging each firstarea alternately with each second area, and change intervals between thefirst areas according to the size of the focus detection area set by thefirst setting unit.

According to another aspect of the present invention, an imagingapparatus includes an image sensor including a pair of photoelectricconversion units for each of a plurality of microlenses arranged in amatrix of rows and columns, and capable of reading a signal from eachrow, a reading control unit configured to perform control so that aplurality of first areas each having a first predetermined number ofrows in which signals used for focus detection are read when signals areread from the image sensor, and a plurality of second areas each havinga second predetermined number of rows in which signals for use in focusdetection are not read, are set by arranging each first area alternatelywith each second area on the image sensor, and a detection unitconfigured to perform phase difference focus detection using, amongsignals read by a first reading control for reading signals for use infocus detection, a pair of focus detection signals obtained from an areaon the image sensor corresponding to a set focus detection area, whereinin a case where a second focus detection area larger in a columndirection than a first focus detection area is set without changing thenumber of rows in which signals are read from the image sensor by thefirst reading control, the reading control unit makes a number of thefirst areas larger than in a case where the first focus detection areais set, and reduces the number of rows in which signals are read by thefirst reading control in each of the first areas, thereby making thefirst area smaller in the column direction than in the case where thefirst focus detection area is set.

According to yet another aspect of the present invention, an imagingapparatus includes an image sensor including a pair of photoelectricconversion units for each of a plurality of microlenses arranged in amatrix of rows and columns, and capable of reading a signal from eachrow, a reading control unit configured to perform control so that aplurality of first areas each having a first predetermined number ofrows in which signals used for focus detection are read by a firstreading control when signals are read from the image sensor, and aplurality of second areas each having a second predetermined number ofrows in which signals for use in focus detection are not read by thefirst reading control, are set by arranging each first area alternatelywith each second area on the image sensor, and a detection unitconfigured to perform phase difference focus detection using, among thesignals read by the first reading control, a pair of focus detectionsignals obtained from an area on the image sensor corresponding to a setfocus detection area, wherein the reading control unit sets a number ofthe first areas and a size in a column direction of each first areaaccording to a size of the set focus detection area without changing thenumber of rows in which signals are read by the first reading controland without making each second area equal to or larger than apredetermined size in the column direction.

According to yet another aspect of the present invention, an imagingapparatus includes an image sensor including a pair of photoelectricconversion units for each of a plurality of microlenses arranged in amatrix of rows and columns, and capable of reading a signal from eachrow, a reading control unit configured to perform control so that afirst area having a first predetermined number of rows in which signalsused for focus detection are read by a first reading control whensignals are read from the image sensor, and a second area having asecond predetermined number of rows in which signals for use in focusdetection are not read by the first reading control, are regularly seton the image sensor, and a detection unit configured to perform phasedifference focus detection using, among the signals read by the firstreading control, a pair of focus detection signals obtained from an areaon the image sensor corresponding to a set focus detection area, whereinin a case where the number of rows in which signals are read from theimage sensor by the first reading control is not changed, and in a casewhere a second focus detection area larger in a column direction than afirst focus detection area is set, the reading control unit continuouslyarranges a plurality of the first areas without changing, from a casewhere the first focus detection area is set, the number of rows in whichsignals are read by the first reading control in each of the firstareas.

According to yet another aspect of the present invention, an imagingapparatus includes an image sensor including a pair of photoelectricconversion units for each of a plurality of microlenses arranged in amatrix of rows and columns, and capable of reading a signal from eachrow, a reading control unit configured to perform control so that afirst area having a first predetermined number of rows in which signalsused for focus detection are read by a first reading control for readingsignals from the image sensor, and a second area having a secondpredetermined number of rows in which signals for use in focus detectionare not read by the first reading control, are regularly set on theimage sensor, and a detection unit configured to perform phasedifference focus detection using, among the signals read by the firstreading control, a pair of focus detection signals obtained from an areaon the image sensor corresponding to a set focus detection area, whereinin a case where the number of rows in which signals are read from theimage sensor by the first reading control is not changed, the readingcontrol unit continuously arranges a plurality of the first areaswithout changing, according to a size of the set focus detection area,the number of rows in which signals are read from the image sensor bythe first reading control and the number of rows in which signals areread by the first reading control in each of the first areas.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments with reference to theattached drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating a configuration of an imagingapparatus.

FIGS. 2A and 2B are diagrams illustrating a partial area of an imagesensor.

FIG. 3 is a diagram illustrating a flowchart of an autofocus (AF)control process.

FIG. 4 is a diagram illustrating a lens driving process (a sub-flow).

FIG. 5 is a diagram illustrating a focus detection signal reading areasetting process (a sub-flow).

FIGS. 6A, 6B, and 6C are diagrams illustrating the focus detectionsignal reading area setting process in FIG.

FIG. 7 is a diagram illustrating an amount-of-defocus calculationprocess (a sub-flow).

FIGS. 8A, 8B, and 8C are diagrams illustrating a focus detection signalreading area setting process in FIG. 5 in a second exemplary embodiment.

FIG. 9 is a diagram illustrating an amount-of-defocus calculationprocess (a sub-flow) in the second exemplary embodiment.

FIG. 10 is a diagram illustrating the focus detection signal readingarea setting process (a sub-flow) in the second exemplary embodiment.

FIGS. 11A and 11B are image diagrams regarding acquisition of signalsfor focus detection from the image sensor.

FIG. 12 is a diagram illustrating deficiencies in a conventionaltechnique for performing imaging plane phase difference focus detection.

DESCRIPTION OF THE EMBODIMENTS

[Configuration of Camera 100]

A first exemplary embodiment of the present invention is describedbelow. A description is given of an imaging apparatus as an example of afocus detection apparatus according to exemplary embodiments of thepresent invention. In the first exemplary embodiment, an example isdescribed where the imaging apparatus is a video camera. The imagingapparatus, however, is not limited to a video camera, and may be anotherimaging apparatus such as a digital still camera. Alternatively, theimaging apparatus may be an imaging apparatus to and from which a lensdevice is attachable and detachable.

FIG. 1 is a block diagram illustrating the configuration of a camera 100as an example of an imaging apparatus according to the first exemplaryembodiment.

The camera 100 includes as an imaging optical system a first fixed lensgroup 101, a variable magnification lens 102, a diaphragm 103, a secondfixed lens group 104, and a focus lens 105 (a focus compensator lens).The variable magnification lens 102 is moved in the optical axisdirection to change the magnification, whereby the focal length can bechanged. The focus lens 105 has both the function of correcting themovements of the focal planes according to a change in themagnification, and a focusing function. The first fixed lens group 101and the second fixed lens group 104 do not move during focusing ormagnification variation.

A zoom driving source 110 is a driving source for moving the variablemagnification lens 102. A focusing driving source 111 is a drivingsource for moving the focus lens 105. Each of the zoom driving source110 and the focusing driving source 111 includes an actuator such as astepping motor, a direct-current (DC) motor, a vibration motor, or avoice coil motor.

Further, the camera 100 includes an image sensor 106, a correlateddouble sampling/automatic gain control (CDS/AGC) circuit 107, a camerasignal processing unit 108, an autofocus (AF) signal processing unit113, a display unit 109, a recording unit 115, a camera control unit114, and a camera operation unit 116.

The image sensor 106 is a member serving as an image sensor and includesa charge-coupled device (CCD) or complementary metal-oxide-semiconductor(CMOS) sensor. The image sensor 106 includes a plurality of pixelportions in a matrix of rows and columns. Each of the pixel portionscorresponds to a single microlens. A light beam passing through theimaging optical system forms an image on a light-receiving surface ofthe image sensor 106, and the image is converted into signal chargesaccording to the amounts of incident light by photodiodes (photoelectricconversion units) included in the respective pixel portions. The signalcharges accumulated in the respective photodiodes are sequentially readas voltage signals according to the signal charges from the image sensor106 based on driving pulses provided by a timing generator 112 accordingto an instruction from the camera control unit 114. The image sensor 106according to the first exemplary embodiment can output an image signaland a focus detection signal. The details will be described below.

The image signal and the focus detection signal read from the imagesensor 106 are input to the CDS/AGC circuit 107, which performs samplingand gain adjustment. Then, the CDS/AGC circuit 107 outputs an imagesignal to the camera signal processing unit 108 and outputs focusdetection signals to the AF signal processing unit 113.

The camera signal processing unit 108 performs various types of imageprocessing on the image signal output from the CDS/AGC circuit 107,thereby generating an image signal. An image signal according to thefirst exemplary embodiment is a signal of a still image or a movingimage to be recorded.

The display unit 109, which includes a liquid crystal display (LCD),displays as a display image the image signal output from the camerasignal processing unit 108.

The recording unit 115 records the image signal from the camera signalprocessing unit 108 in a recording medium such as a magnetic tape, anoptical disc, or a semiconductor memory.

The AF signal processing unit 113 performs a correlation calculationusing the focus detection signals (two image signals having parallax)output from the CDS/AGC circuit 107. The AF signal processing unit 113calculates the amount of correlation (the amount of image shift), theamount of defocus, reliability information (the degree of coincidencebetween two images, the degree of steepness between two images, contrastinformation, saturation information, and scratch information). The AFsignal processing unit 113 outputs the calculated amount of defocus andreliability information to the camera control unit 114. Further, basedon the acquired amount of defocus and reliability information, thecamera control unit 114 performs control to change the settings of theAF signal processing unit 113. The correlation calculation is a knowncalculation, and is not described in the first exemplary embodiment.

The camera control unit 114 governs the control of the operation of theentirety of the camera 100 and also performs AF control for controllingthe focusing driving source 111 to move the focus lens 105. Further,according to an input from the camera operation unit 116, the cameracontrol unit 114 executes various camera functions operated by a user,such as changing the position and the size of a focus detection area,turning on or off the camera 100, changing a setting, startingrecording, starting AF control, and confirming a recorded video image.

[Image Sensor 106]

FIG. 2A illustrates a part of the light-receiving surface of the imagesensor 106. The image sensor 106 includes a pair of photodiodes(photodiodes A and B) for a single pixel portion (which corresponds to asingle microlens (not illustrated)), and these pixel portions arearranged in an array on the image sensor 106. Consequently, the pixelportions can receive light beams passing through different areas of anexit pupil of the imaging optical system. That is, an A-image signalacquired from the photodiode A and a B-image signal acquired from thephotodiode B have parallax. Thus, it is possible to perform imagingplane phase difference focus detection separately using the A-imagesignal and the B-image signal read from the image sensor 106. That is,the AF signal processing unit 113 performs a correlation calculationbased on the A-image signal and the B-image signal, thereby calculatingthe amount of defocus and various pieces of information such asreliability information.

Further, the A-image signal acquired from the photodiode A and theB-image signal acquired from the photodiode B are added together,whereby an image signal (the A-image signal+the B-image signal) to berecorded can be output.

In the first exemplary embodiment, an image signal (the A-imagesignal+the B-image signal) and a focus detection signal (the A-imagesignal) are output from the image sensor 106, and a focus detectionsignal (the B-image signal) is generated based on the image signal (theA-image signal+the B-image signal) and the focus detection signal (theA-image signal). The present invention, however, is not limited to sucha method so long as an image signal and focus detection signals can beobtained. Alternatively, for example, an image signal (the A-imagesignal+the B-image signal) and a focus detection signal (the B-imagesignal) may be read. Yet alternatively, a first focus detection signal(the A-image signal) and a second focus detection signal (the B-imagesignal) may be read and then added together later, thereby generating animage signal (the A-image signal+the B-image signal).

Further, FIG. 2A illustrates an example where pixel portions, eachhaving two photodiodes for a single microlens (microlens not shown), arearranged in an array of rows and columns to form a matrix.Alternatively, pixel portions, each having three or more photodiodes fora single microlens, may be arranged in an array. Yet alternatively, aplurality of pixel portions of which light-receiving portions havedifferent aperture positions may be included for a microlens. That is,it is only necessary to, as a result, obtain two focus detection signalssuch as the A-image signal and the B-image signal for allowing thedetection of phase difference focus detection and an image signal fromthe image sensor 106.

FIG. 2B schematically illustrates the arrangement of color filtersincluded in the respective pixels of the image sensor 106, and the colorfilters are placed in the Bayer arrangement based on red (R), blue (B),and green (Gb, Gr) patterns.

[AF Control Process]

Next, an AF control process executed by the camera control unit 114 isdescribed.

FIG. 3 is a flowchart illustrating an AF control process executed by thecamera control unit 114 in FIG. 1. This processing is executed accordingto a computer program stored in the camera control unit 114.

Further, this processing is executed, for example, in the cycle (everyvertical synchronization period) of reading an image signal from theimage sensor 106 for generating a one-field image (hereinafter referredto also as “one frame” or “one screen”). Alternatively, this processingmay be repeated multiple times in a vertical synchronization period (aV-rate).

First, in step S301, the camera control unit 114 (a setting unit) setsthe position and the size of a focus detection area.

In step S302, the camera control unit 114 executes a focus detectionsignal reading area setting process on the focus detection area set instep S301. The details of the focus detection signal reading areasetting process will be described below with reference to a sub-flow inFIG. 5.

In step S303, the camera control unit 114 determines whether an AFsignal is updated. If the camera control unit 114 determines that the AFsignal is updated (YES in step S303), then in step S304, the AF signalprocessing unit 113 executes an amount-of-defocus calculation process.The details of the amount-of-defocus calculation process will bedescribed below with reference to a sub-flow in FIG. 7. If, on the otherhand, the camera control unit 114 determines in step S303 that the AFsignal is not updated (NO in step S303), the processing of this flowends.

In step S305, the camera control unit 114 determines whether the amountof defocus calculated in step S304 is within a predetermined depth, andthe reliability level of the amount of defocus is higher than apredetermined level, i.e., the amount of defocus is reliable. If thecamera control unit 114 determines that the amount of defocus is withinthe predetermined depth, and the reliability of the amount of defocus ishigher than the predetermined level (YES in step S305), then in stepS306, the camera control unit 114 sets an in-focus stop flag to on. Ifthe camera control unit 114 determines that the condition that theamount of defocus is within the predetermined depth, and the reliabilityof the amount of defocus is higher than the predetermined level is notsatisfied (NO in step S305), then in step S308, the camera control unit114 sets the in-focus stop flag to off. The state where the in-focusstop flag is on indicates the state where the focus is controlled to beat an in-focus position, and the control of the focus should be stopped.

The reliability level of the amount of defocus is defined such that in acase where it can be determined that the accuracy of the calculatedamount of defocus is credible, the reliability level is “high”, and in acase where a defocus direction indicating the direction in which a focusposition may exist is credible, the reliability level is “medium”. Forexample, the case where the reliability level of the amount of defocusis “high” is a case where the level of the degree of coincidence betweentwo images calculated by the AF signal processing unit 113 is equal toor greater than a predetermined value. This corresponds to, for example,a case where the contrast between the A-image signal and the B-imagesignal is high, and the shapes of the A-image signal and the B-imagesignal are similar (the level of the degree of coincidence between twoimages is high), or a case where a main object image is already infocus. In this case, driving is performed relying on the amount ofdefocus.

The case where the reliability level of the amount of defocus is“medium” is the state where the level of the degree of coincidencebetween two images calculated by the AF signal processing unit 113 islower than the predetermined value, but there is a certain tendency inthe correlation obtained by shifting the A-image signal and the B-imagesignal relative to each other, and the defocus direction is reliable.This determination is often made, for example, in the state where a mainobject is slightly blurred. Further, in a case where both the amount ofdefocus and the defocus direction are unreliable, the camera controlunit 114 determines that the reliability level is low. This correspondsto, for example, the state where the contrast between the A-image signaland the B-image signal is low, and the level of the degree ofcoincidence between two images is also low. This determination is oftenmade in the state where an object is greatly blurred. In this state, itis difficult to calculate the amount of defocus.

In step S307, according to the fact that the in-focus stop flag is on(the amount of defocus is within the predetermined depth, and thereliability of the amount of defocus is high), the camera control unit114 stops lens driving for controlling the focus. Then, the processingof this flow ends.

If, on the other hand, the in-focus stop flag is set to off in stepS308, then in step S309, a lens driving process is performed. Then, theprocessing of this flow ends. The details of the lens driving processwill be described below with reference to a sub-flow in FIG. 4.

[Focus Detection Signal Reading Area Setting Process]

[Flow in FIG. 5]

FIG. 5 is a sub-flow illustrating the details of the focus detectionsignal reading area setting process (step S302) in FIG. 3.

First, in step S501, the camera control unit 114 acquires the size inthe column direction of the focus detection area set in step S301. Atthis time, the camera control unit 114 acquires, as the size in thecolumn direction of the focus detection area, the number of rows in thecolumn direction of the focus detection area (hereinafter referred to asa “first number of rows”). That is, the first number of rows describesthe size in pixels in the column direction of the focus detection area.

In step S502, the camera control unit 114 acquires the number of rows inthe column direction of areas where focus detection signals are read inthe focus detection area (hereinafter referred to as a “second number ofrows”). That is, the second number of rows describes the number of rowsin the column direction of areas where focus detection signals are readwithin the focus detection area (for example, total number of rows ofareas 602 a to 602 l). The second number of rows differs depending onthe image capture mode and the frame rate. For example, the secondnumber may be smaller, when the frame rate is higher, to reduce the timeto read the focus detection signal.

In step S503, the camera control unit 114 calculates a third number ofrows (described below) based on the second number of rows. The thirdnumber of rows is a threshold for the camera control unit 114 todetermine whether the first number of rows is greater than apredetermined size with respect to the second number of rows. Thus, itis desirable to calculate the third number of rows according to thesecond number of rows.

Then, in step S504, the camera control unit 114 compares the firstnumber of rows with the third number of rows.

If the camera control unit 114 determines that the first number of rowsis less than or equal to the third number of rows (NO in step S504),then in step S505, the camera control unit 114 sets an area (first area)on the image sensor 106 where focus detection signals are read withinthe focus detection area to an area continuous by a first number ofpixels in the column direction.

In the focus detection area, the first area includes as many rows inwhich the camera control unit 114 (a reading control unit) performscontrol for reading focus detection signals (first reading control) as apredetermined number of rows such that the rows are continuous in thecolumn direction. On the other hand, an area where the camera controlunit 114 performs control for reading only an image signal withoutreading signals for use in focus detection (second reading control) isreferred to as a “second area”. In the present exemplary embodiment, asdescribed above, the number of rows in which the first reading controlis performed on the image sensor 106 is desired to be limited to therebyshorten the time required to read one frame from the image sensor 106.

The reason why as many rows in which the first reading control isperformed as the predetermined number of rows are made continuous in thecolumn direction is as follows. That is, the signals acquired from thecontinuous rows are added later to calculate the amount of correlation.Thus, it is desirable that the obtained amount of correlation shouldhave as close a correlation as possible. In contrast, if as many rows inwhich the first reading control is performed as the predetermined numberof rows are not made continuous in the column direction, and these rowsare discretely arranged, signals corresponding to different portions ofan object are highly likely to be read from the respective rows andadded together. If signals corresponding to different portions of anobject are read and added together, it is highly likely that the amountof correlation corresponding to an intended portion of the object cannotbe obtained. Thus, as many rows in which the first reading control isperformed as the predetermined number of rows are made continuous in thecolumn direction.

The camera control unit 114 (the reading control unit) controls thereading of signals so that each of a plurality of first areas and aplurality of second areas are set by arranging in the column directioneach first area alternately with each second area.

If the camera control unit 114 determines that the first number of rowsis greater than the third number of rows (YES in step S504), then instep S506, the camera control unit 114 sets the area (the first area) onthe image sensor 106 where focus detection signals are read within thefocus detection area (to an area continuous by a second number of pixelsin the column direction. Also in this case, the focus detection areaincludes a plurality of first areas. The camera control unit 114 (thereading control unit) controls the reading of signals so that theplurality of first areas and a plurality of areas (second areas) wherefocus detection signals are not read within the focus detection area areset by alternately arranging each first area and each second area.

[Steps S505 and S506]

FIG. 6A to 6C are diagrams illustrating images in steps S505 and S506 inFIG. 5. For ease of description, as an example, the description is givenon the assumption that the second number of rows is 96 rows, the thirdnumber of rows is 192 rows (twice the second number of rows), the firstnumber of pixels is 16 pixels, and the second number of pixels is 8pixels. These numbers, however, are not limited to this example so longas the numbers are consistent with the general scope of the presentexemplary embodiment. Further, the first number of pixels only needs tobe greater than the second number of pixels.

[Case where First Number of Rows and Second Number of Rows are the Same]

FIG. 6A is a diagram illustrating a case where as an example, when thefirst number of rows and the second number of rows are both 96 rows, thearea (the first area) where focus detection signals are read from withinthe focus detection area is set to an area continuous by the firstnumber of pixels in the column direction in step S505. In FIG. 6A, sincethe first number of rows and the second number of rows are equal, thearea (the second area) where focus detection signals are not read fromwithin the focus detection area is not included. Since the first numberof pixels is 16 pixels at this time, six areas (first areas) 601 a, 601b, 601 c, 601 d, 601 e, and 601 f where focus detection signals are readfrom within the focus detection area are included. That is, it ispossible to detect a phase difference corresponding to each of the sixareas (first areas) 601 a-601 f.

Problem Assumed in Present Exemplary Embodiment

With reference to FIG. 6C, a description is given of a problem thatarises in a case where the first number of rows is greater than thethird number of rows and the size of the area (the first area) wherefocus detection signals are read from within the focus detection area isnot adjusted. In FIG. 6C, unlike step S506 in the present exemplaryembodiment, the first areas 603 a, 603 b, 603 c, 603 d, 603 e and 603 fare set to an area having the first number of pixels in the columndirection similarly to FIG. 6A. The greater the number of pixels in thecolumn direction of the first area, the more easily the focus detectionis performed on an object having low contrast using the obtainedsignals. Further, there is also an advantage in terms of thesignal-to-noise (S/N) ratio. In terms of these, however, in a case wherethe focus detection area becomes larger in the column direction withoutreducing the number of pixels in the column direction of the first areaand the number of first areas, the size in the column direction of thesecond areas (areas between 603 a-603 b, 603 b-603, etc.) becomeslarger, and an object is highly likely to enter the second area.

A case where the first number of rows is greater than the third numberof rows in step S504 (YES in S504) is a case where it is determined thatan object is highly likely to enter the second area. In the firstexemplary embodiment, as an example, the third number of rows is twicethe number of rows in the column direction in which focus detectionsignals are read (the second number of rows). In this case, if the firstnumber of rows is greater than the third number of rows, the number ofpixels in the column direction of the second area is greater than thenumber of pixels in the column direction of the first area. As describedabove, in a case where the first number of rows is greater than thethird number of rows, and if the camera control unit 114 sets the firstarea on the image sensor 106 to an area continuous by the first numberof pixels in the column direction, the second area, which is an area inthe space between first areas, becomes relatively large. If an objecthaving contrast enters the second area, which is a space, a phasedifference cannot be detected (hereinafter referred to also as “objectmissing”). That is, it is not possible to perform focus detection on anobject that should be subjected to focus detection. If it is possible toperform focus detection on an object that should be subjected to focusdetection in a certain frame, and it is not possible to perform focusdetection on the object in the next frame due to the fact that theobject enters the second area, it is not possible to continue to stablybring the object into focus.

[Case where First Number of Rows is Greater than Third Number of Rows]

Thus, in the present exemplary embodiment, the camera control unit 114sets the first area and the second area in such a manner that the secondarea is not larger than or equal to a predetermined size. To solve thepotential deficiencies described with reference to FIG. 6C, in thepresent exemplary embodiment, in a case where the first number of rowsis greater than the third number of rows, the camera control unit 114performs control so that the area (the first area) where focus detectionsignals are read from within the focus detection area is set to an areacontinuous by the second number of pixels in the column direction. FIG.6B illustrates an example of the case where the first number of rows isgreater than the third number of rows. Since the second number of pixelsis assumed to be 8 pixels as described above, the focus detection areaincludes 12 areas (first areas) 602 a to 6021 where focus detectionsignals are read. In this case, the size in the column direction of theareas (second areas) where focus detection signals are not read fromwithin the focus detection area, which is an area in the space betweenfirst areas, is smaller than in the case illustrated in FIG. 6C. Thatis, object missing is less likely to occur in the focus detection areaof FIG. 6B than in the case illustrated in FIG. 6C. Thus, it is possibleto perform more stable focusing in successive frames even if an objectmoves.

In the present exemplary embodiment, an example has been illustratedwhere the third number of rows is set so that the size in the columndirection of the second areas is less than or equal to the size in thecolumn direction of the first areas. As an example, the third number ofrows is twice the second number of rows. The third number of rows,however, is not limited to this. The third number of rows may becalculated to obtain the size of the second areas according to the sizeof the object being focused on, so that it is possible to minimize orprevent the issue of object missing.

[Effects of Step S506]

As described above, in the present exemplary embodiment, in a case wherethe first number of rows is greater than the third number of rows, thenumber of pixels in the column direction of the first area is set to thesecond number of pixels that is smaller than the first number of pixelsin a case where the first number of rows is less than or equal to thethird number of rows. Consequently, it is possible to perform morestable focusing.

[Effects of Step S505]

On the other hand, in the present exemplary embodiment, in a case wherethe first number of rows is less than or equal to the third number ofrows, the number of pixels in the column direction of the first area isset to the first number of pixels that is greater than the second numberof pixels. The number of pixels in the column direction of the firstarea is thus made greater, thereby adding together more signals of rowscontinuous in the column direction. Signals of rows in which the sameobject is highly likely to be captured are added together, and the addedsignals are used to calculate the amount of correlation, whereby it ispossible to maintain a high S/N ratio and facilitate the obtaining ofthe steepness of the amount of correlation (the details will bedescribed below).

[Amount-of-Defocus Calculation Process]

FIG. 7 is a flowchart illustrating the details of the amount-of-defocuscalculation process (step S304) in FIG. 3.

In the present exemplary embodiment, the amount of defocus may bereplaced by the absolute distance from the in-focus position or thenumber of pulses. Alternatively, the amount of defocus may be a conceptdifferent in dimension and unit from such a concept, or may be a conceptrelative to such a concept. The amount of defocus only needs to be aconcept indicating that it can be determined how far from an in-focusstate the current state is, and indicating that it can be determined howmuch focus control should be performed to enable the shifting to thein-focus state.

First, in step S701, the camera control unit 114 acquires focusdetection signals (the A-image signal and the B-image signal)corresponding to the area where focus detection signals are read in thefocus detection area (the first area).

Next, in step S702, the camera control unit 114 compares the firstnumber of rows with the third number of rows.

If the first number of rows is less than or equal to the third number ofrows (NO in step S702), then in step S703, the camera control unit 114(a signal addition unit) performs control so that among the signals readfrom the rows of each first area, as many signals as the first number ofpixels are added together in the column direction.

In step S704, based on the signals calculated by the addition in stepS703, the AF signal processing unit 113 calculates the amount ofcorrelation of each first area.

In step S705, among the plurality of amounts of correlation calculatedregarding the respective first areas, the AF signal processing unit 113adds as many amounts of correlation as a first number of amounts ofcorrelation together. That is, in a case where as many signals as thefirst number of pixels are added together in the column direction instep S703, the first number of amounts of correlation coincides with thenumber of the first areas in the focus detection area.

If the first number of rows is greater than the third number of rows(YES in step S702), then in step S706, the camera control unit 114performs control so that among the signals read from the rows of eachfirst area, as many signals as the second number of pixels are addedtogether in the column direction.

In step S707, based on the image signals calculated by the addition instep S706, the AF signal processing unit 113 calculates the amount ofcorrelation of each first area.

In step S708, among the plurality of amounts of correlation calculatedregarding the respective first areas, the AF signal processing unit 113adds as many amounts of correlation as a second number of amounts ofcorrelation together. That is, in a case where as many signals as thesecond number of pixels are added together in the column direction instep S706, the second number of amounts of correlation coincides withthe number of the first areas in the focus detection area.

Then, in step S709, the AF signal processing unit 113 calculates theamount of change in correlation using the amounts of correlationcalculated by the addition in step S705 or step S708. Then, in stepS710, the AF signal processing unit 113 calculates the amount of focusshift from the calculated amount of change in correlation. The amount ofchange in correlation as used herein is known and discussed in thepublication of Japanese Patent Application Laid-Open No. 2014-17446, forexample.

Further, in step S711, the AF signal processing unit 113 calculates areliability level indicating how reliable the calculated amount of focusshift is.

Then, in step S712, the AF signal processing unit 113 converts theamount of focus shift output in step S710 into the amount of defocus.

At this time, the relationship between the first number of amounts ofcorrelation and the second number of amounts of correlation is such thatthe first number of amounts of correlation is less than or equal to thesecond number of amounts of correlation. That is, even if the number offirst areas to be added in the column direction is small, the number ofamounts of correlation to be added is increased, whereby it is possibleto improve the accuracy of the calculation result of a correlationcalculation.

Further, for example, in a case where AF control using a known facedetection function (not illustrated) is executed, the focus detectionarea is always set at the face position of a person. Thus, even if thefocus detection area becomes larger, it is highly likely that the sameobject is captured. In this case, the number of pixels based on whichsignals are added together in the column direction may always be thesame. On the other hand, in a case where the size of the focus detectionarea is specified by the user, there is also a possibility that the sameobject is not captured. Thus, the number of pixels based on whichsignals are added together in the column direction may be reduced.

According to the above, an area where focus detection signals are readand the setting of the size of the area are changed according to thesize of a focus detection area, whereby it is possible to reduceunstable focusing due to object missing or the capturing of differentobjects.

[Significance of Addition in Steps S703 and S706]

In phase difference AF, in a case where an object having low contrast iscaptured, or an object having low illuminance is captured, there is apossibility that the levels of the A-image signal and the B-image signalbecome low. In such a case, it is difficult to obtain the steepness ofthe amount of correlation. This causes a decrease in the accuracy of theamount of defocus. Further, in the case of an object having lowcontrast, the object is also likely to be influenced by shading.Further, in a case where the object is captured in the state where theInternational Organization for Standardization (ISO) sensitivity isincreased, an increase in noise reduces the S/N ratio. Thus, theaccuracy of the amount of defocus decreases, and the reliability levelof the amount of defocus decreases.

Further, also in a case where a blurred object is captured, the signallevels are similar to those in the state of an object having lowcontrast. Thus, it is difficult to determine whether a blurred object oran object having low contrast is captured.

In the present exemplary embodiment, as many signals as a predeterminednumber of pixels (the first number of pixels or the second number ofpixels) of the area where focus detection signals are read in the focusdetection area (the first area) are added together in the columndirection. This reduces a decrease in the S/N ratio and facilitates theobtaining of the steepness of the amount of correlation.

Further, it is possible to obtain similar effects also by addingtogether a plurality of amounts of correlation output from the rows ofthe first area.

[Lens Driving Process]

FIG. 4 is a sub-flow illustrating the details of the lens drivingprocess (step S309) in FIG. 3.

First, in step S401, the camera control unit 114 determines whether theamount of defocus is obtained, and the reliability level of the amountof defocus is high. If the amount of defocus is obtained, and thereliability level of the amount of defocus is high (YES in step S401),then in step S402, the camera control unit 114 determines a drivingamount and a driving direction based on the amount of defocus.

Then, in step S403, the camera control unit 114 clears an error countand an end count, and the processing of this flow is ended.

If the amount of defocus is not obtained, or the reliability level ofthe amount of defocus is not high (NO in step S401), then in step S404,the camera control unit 114 determines whether the error count exceeds afirst count. At this time, although not illustrated, the first count maybe a value determined and stored in advance in a non-volatile memory. Inthe present exemplary embodiment, as an example, a value equal to orgreater than twice a second count is set as the first count.

If the camera control unit 114 determines that the error count is lessthan or equal to the first count (NO in step S404), then in step S405,the camera control unit 114 counts up the error count, and theprocessing is ended.

If the camera control unit 114 determines that the error count isgreater than the first count (YES in step S404), then in step S406, thecamera control unit 114 determines whether a search driving flag is on.

If the camera control unit 114 determines in step S406 that the searchdriving flag is off (NO in step S406), this is not the state where asearch operation is started, or a search is currently performed. Inresponse, in step S407, the camera control unit 114 sets the searchdriving flag to on. Then, in step S408, the camera control unit 114determines whether the reliability level of the amount of defocus is“medium”.

If the camera control unit 114 determines that the reliability is“medium” (YES in step S408), then in step S409, the camera control unit114 sets the driving direction using a defocus direction. Then, in stepS411, the camera control unit 114 sets a predetermined driving amount.At this time, the camera control unit 114 performs search driving fordriving the focus by the predetermined amount in the obtained defocusdirection without driving the focus based on the absolute value itselfof the amount of defocus.

If the camera control unit 114 determines that the reliability is not“medium” (NO in step S408), then in step S410, the camera control unit114 sets the driving direction to a direction away from the lens end.Then, in step S411, the camera control unit 114 sets the predetermineddriving amount.

As the predetermined driving amount in step S411, a value determined andstored in advance in a non-volatile memory may be used. For example, thedriving amount is set to a distance several times the depth of focus.Alternatively, the driving amount may be variable according to the focallength. For example, the driving amount may be such that the longer thefocal length, the greater the driving amount. The search drivingdirection at this time is, for example, the direction in which the lensend is distant from the current focus position.

If the camera control unit 114 determines that the search driving flagis on (YES in step S406), this is the state where search driving isalready executed. Thus, the camera control unit 114 continues to executethe previous focus control. Then, in step S412, the camera control unit114 determines whether the search driving reaches the lens end, which isthe limitation position of lens driving when focus control is performed.If the search driving reaches the lens end (YES in step S412), then instep S413, the camera control unit 114 counts up the end count.

If the camera control unit 114 determines that the end count exceeds apredetermined value (YES in step S414), it is indicated that a credibleamount of defocus cannot be obtained even by moving the focus lens 105from a close end to an infinite end. Thus, the camera control unit 114determines that there is no object that can be brought into focus. Then,in step S415, the camera control unit 114 sets the search driving flagto off. In step S416, the camera control unit 114 performs control sothat the lens driving is stopped. Then, in step S417, the camera controlunit 114 clears the error count and the end count, and the processing ofthis flow is ended.

If the camera control unit 114 determines that the end count does notexceed the predetermined value (NO in step S414), then in step S418, thecamera control unit 114 sets the driving direction of the lens involvedin the focus control to a driving direction opposite to the currentdriving direction. Then, in step S411, the camera control unit 114 setsthe predetermined driving amount.

Effects of First Exemplary Embodiment

As described above, in the first exemplary embodiment, in a case wherethe number of rows in which signals are read from the image sensor 106by the first reading control is the same, if a focus detection arealarger than a predetermined size is set, the number of first areas inthe image sensor 106 is increased. Further, the number of rows in whichsignals are read by the first reading control in each first area isreduced, thereby making the first area smaller in the column direction.

In other words from a different viewpoint, in a case where the number ofrows in which signals are read from the image sensor 106 by the firstreading control is the same, the number of rows in which signals areread by the first reading control in each first area is not changed, andthe second area is not made equal to or larger than a predetermined sizein the column direction. To this end, the respective numbers of firstand second areas and the respective sizes in the column direction of thefirst and second areas are set according to the size of a set focusdetection area.

Consequently, it is possible to prevent the second area from becomingequal to or larger than the predetermined size. That is, it is possibleto prevent an object from coming out to the second area. Thus, accordingto the first exemplary embodiment, it is easy to adjust focus detectionto a main object even if the size of the focus detection area ischanged.

A description is given below of a second exemplary embodiment, which isa variation of the first exemplary embodiment.

The second exemplary embodiment is different from the first exemplaryembodiment in that it is assumed that the size in the column directionof the first area is constant.

Further, in the first exemplary embodiment, the area where focusdetection signals are read in the focus detection area (the first area)and the area where focus detection signals are not read in the focusdetection area (the second area) are alternately arranged. In contrast,the second exemplary embodiment is different from the first exemplaryembodiment in that even though the first area and the second area areregularly arranged, a plurality of first areas are continuous. Portionssimilar to those of the first exemplary embodiment are not described,and the differences from the first exemplary embodiment are mainlydescribed here.

FIGS. 8A to 8B are diagrams illustrating images in steps S505 and S506in FIG. 5 in the second exemplary embodiment. FIGS. 8B and 8C illustratecases where the focus detection area is larger than that in FIG. 8A,namely 1.5 times that in FIG. 8A and twice that in FIG. 8A,respectively.

In FIGS. 6A to 6C, the size in the column direction of the first areaincluded in the focus detection area is different between FIGS. 6A and6B. In FIGS. 8A, 8B, and 8C, however, it is assumed that the size in thecolumn direction of the first area included in the focus detection areais constant. For example, an area 1101 a in FIG. 8A, an area 1102 a inFIG. 8B, and an area 1103 a in FIG. 8C are of the same size in thecolumn direction.

Further, in FIG. 6B, unlike FIG. 6A, a plurality of first areas and aplurality of second areas are set by alternately arranging each firstarea and each second area. In FIG. 8B, unlike FIG. 8A, a plurality ofcontinuous first areas and a second area are regularly set.

If each first area (phase difference detection area) and each secondarea are simply alternately arranged according to the size of the focusdetection area as in the first exemplary embodiment, there is a casewhere different objects are captured in the first areas depending on thesize of the second area, which is the space between the first areas, orthe positions of the objects. If different objects are captured indifferent first areas, the first areas of which the amounts ofcorrelation are added together in steps S705 and S708 correspond to thedifferent objects. Thus, there is a case where the discrepancy betweenthe calculated focus detection result and the proper focus detectionresult becomes large. Thus, in the second exemplary embodiment, aplurality of first areas are continuously set in the column direction.Consequently, it is highly likely that the same object can be capturedin the continuous first areas. Thus, the accuracy of the focus detectionresult becomes higher. In the second exemplary embodiment, similarly tothe first exemplary embodiment, the amount of correlation is calculatedfrom each first area, and focus detection is performed based on theadded amount of correlation obtained by adding the amounts ofcorrelation. Thus, the more the first areas where a desired object to bebrought into focus is captured, the closer the added amount ofcorrelation is to a proper amount of correlation for bringing a desiredobject into focus. Thus, a plurality of first areas are made continuousso that the same object can be captured, whereby it is possible toperform focus detection using signals read from areas of an object moreintended by the user than in the conventional art.

Amount-of-Defocus Calculation Process in Second Exemplary Embodiment

FIG. 9 is a flowchart illustrating an amount-of-defocus calculationprocess in a case where the first area is set as described withreference to FIGS. 8A to 8B.

First, in step S1201, the AF signal processing unit 113 acquires focusdetection signals (the A-image signal and the B-image signal)corresponding to the area where focus detection signals are read in thefocus detection area (the first area).

Next, in step S1202, among the signals read from the rows of each firstarea in step S1201, the AF signal processing unit 113 adds as manysignals as a predetermined number of pixels together in the columndirection. At this time, the predetermined number of pixels may be thesmallest number of pixels that makes the accuracy of the detectionresult reliable in phase difference detection in an object havingcontrast. As an example, the predetermined number of pixels is 8 pixels.

In step S1203, based on the image signals calculated by the addition instep S1202, the AF signal processing unit 113 calculates the amount ofcorrelation of each first area.

In step S1204, among the amounts of correlation calculated regarding therespective first areas in step S1203, the AF signal processing unit 113adds a plurality of amounts of correlation together, thereby calculatingthe added amount of correlation. The number of amounts of correlation tobe added together at this time is constant regardless of the size of thefocus detection area.

Then, in step S1205, the AF signal processing unit 113 calculates theamount of change in correlation from the added amount of correlation.Then, in step S1206, the AF signal processing unit 113 calculates theamount of focus shift from the calculated amount of change incorrelation.

Further, in step S1207, the AF signal processing unit 113 calculates areliability level indicating how reliable the calculated amount of focusshift is.

Then, in step S1208, the AF signal processing unit 113 converts theamount of focus shift output in step S1206 into the amount of defocus.

At this time, for example, in a case where AF control using a known facedetection function (not illustrated) is executed, the focus detectionarea is always set at the face position of a person. Thus, even if thefocus detection area becomes larger, it is highly likely that the sameobject is captured. In this case, the number of pixels based on whichsignals are added together in the column direction may always be thesame. On the other hand, in a case where the size of the focus detectionarea is specified by the user, there is also a possibility that the sameobject is not captured. Thus, the number of pixels added together in thecolumn direction may be reduced.

In the second exemplary embodiment, as an example, the first number ofpixels is 16 pixels, and the second number of pixels is 8 pixels. Thesenumbers, however, are not limited to this example. The first number ofpixels only needs to be greater than the second number of pixels.

Effects of Second Exemplary Embodiment

As described above, in the second exemplary embodiment, a plurality ofcontinuous first areas and a second area are regularly arranged.Consequently, it is easy to capture the same object in the plurality offirst areas continuously set (FIGS. 8A and 8B). Further, in a case wherethe size of the second area is equal to or great than a predeterminedsize, a plurality of first areas and a plurality of second areas are setby alternately arranging each first area and each second area (FIG. 8C).This can prevent an object from coming out to the space between firstareas. Thus, it is possible to adjust focus detection to a main objecteven if the size of the focus detection area is changed.

A description is given below of a third exemplary embodiment, which is avariation of the first exemplary embodiment.

The third exemplary embodiment is different from the first exemplaryembodiment in that in a flow in FIG. 10, which corresponds to FIG. 5 inthe first exemplary embodiment, it is determined whether illuminance islow between steps S504 and S506. Portions similar to those of the firstexemplary embodiment are not described, and the differences from thefirst exemplary embodiment are mainly described here.

FIG. 10 is a diagram illustrating a sub-flow of a focus detection signalreading area setting process in the third exemplary embodiment.

In steps S1301 to S1304, processes similar to those of steps S501 toS504 in the first exemplary embodiment are performed. Thus, steps S1301to S1304 are not described here.

If the camera control unit 114 determines that the first number of rowsis less than or equal to the third number of rows (NO in step S1304),then in step S1306, the camera control unit 114 sets the area wherefocus detection signals are read in the focus detection area (the firstarea) to an area continuous by the first number of pixels in the columndirection.

If, on the other hand, the camera control unit 114 determines that thefirst number of rows is greater than the third number of rows (YES instep S1304), then in step S1305, the camera control unit 114 determineswhether an object having low illuminance is captured.

If the camera control unit 114 determines that an object having lowilluminance is captured (YES in step S1305), then in step S1306, thecamera control unit 114 sets the area where focus detection signals areread in the focus detection area (the first area) to an area continuousby the first number of pixels in the column direction. At this time, thecamera control unit 114 performs control so that the area where focusdetection signals are read in the focus detection area (the first area)and the area where focus detection signals are not read in the focusdetection area (the second area) are regularly arranged.

If, on the other hand, the camera control unit 114 determines that anobject having low illuminance is not captured (NO in step S1305), thenin step S1307, the camera control unit 114 sets first areas continuousby the second number of pixels in the column direction, at regularintervals in the focus detection area.

At this time, the determination of whether an object having lowilluminance is captured may be made, for example, based on whether thestate of the ISO sensitivity set by the user is greater than apredetermined value. Alternatively, the determination may be made basedon whether the luminance value of a captured video image is smaller thana predetermined value. The determination is not limited to this so longas a method capable of determining the illuminance of an object is used.

When a phase difference is detected, the amount of defocus is calculatedby adding pixels together in the column direction or adding the amountsof correlation together in the column direction.

The reason for this is as follows. In a case where an object having lowilluminance is captured, there is a possibility that the levels of theA-image signal and the B-image signal become low as described above. Insuch a case, it is difficult to obtain the steepness of the amount ofcorrelation. This causes a decrease in the accuracy of the amount ofdefocus. Further, in a case where an object is captured in the statewhere the ISO sensitivity is increased, an increase in noise reduces theS/N ratio. Thus, the accuracy of the amount of defocus decreases, andthe reliability level of the amount of defocus decreases.

Thus, it is necessary to improve the S/N ratio by increasing or notreducing the number of pixels based on which signals are added togetherin the column direction in the first area, or increasing the amounts ofcorrelation to be added together. Thus, in a case where it is determinedin advance that an object having low illuminance is captured, and evenif the focus detection area becomes larger, control is executed bygiving priority to the output of a reliable amount of defocus.

Effects of Third Exemplary Embodiment

As described above, in the third exemplary embodiment, in a case wherean object has low illuminance, the area where focus detection signalsare read in the focus detection area (the first area) is set to an areacontinuous in the column direction by the first number of pixels that isgreater than the second number of pixels, regardless of the size of thefocus detection area. Consequently, it is possible to obtain the effectthat the amount of correlation can be calculated with higher accuracyeven in a case where an object has low illuminance, in addition to theeffects of the first exemplary embodiment.

Other Exemplary Embodiments

In the first exemplary embodiment, a case has been described where thecamera control unit 114 (the reading control unit) sets a plurality offirst areas and a plurality of second areas by alternately arrangingeach first area and each second area. Alternatively, the first areas maybe made continuous in the column direction and set in the center of thefocus detection area until the focus detection area reaches apredetermined size. That is, the first areas may be set in the center,and the second areas may be provided above and below the first areas.Consequently, it is highly likely that the same object can be capturedin the first areas.

In the first to third exemplary embodiments, a case has been describedwhere focus detection signals are read only from a partial area of theimage sensor 106 (FIG. 11A). Alternatively, focus detection signals maybe read from the entire imaging area of the image sensor 106, and someof the focus detection signals may be held according to the capacity ofa volatile memory (not illustrated) when the focus detection signals aretemporarily held (FIG. 11B). The first to third exemplary embodimentscan be applied in either case. FIGS. 11A and 11B illustrate entireimaging areas 1401 and 1402 where signals can be read from the imagesensor 106, and shaded portions indicate areas where both an imagesignal (A+B) and a focus detection signal A (or B) are read.

Further, the first and second exemplary embodiments may be combinedtogether. For example, if the size of the focus detection area is lessthan or equal to a predetermined size, the determination of whether tomake a plurality of first areas continuous is varied according to thesize of the focus detection area without changing the size in the columndirection of the first area and the number of first areas as in thesecond exemplary embodiment. Then, in a case where the focus detectionarea becomes larger than the predetermined size, and it is determinedthat if the first area and the second area are alternately arrangedwithout changing the size in the column direction of the first area andthe number of first areas as in FIG. 8C, an object will enter the secondarea, processing is performed as in the first exemplary embodiment. Thatis, the size in the column direction of the first area is made smaller,and the number of first areas is increased. Consequently, it is possibleto obtain effects similar to those of the first and second exemplaryembodiments.

Further, in a case where the number of first areas is great as in FIGS.6B and 8C, the number of the amounts of correlation to be calculatedalso increases as compared with a case where the number of first areasis not great. Thus, it takes more time to calculate the amount ofdefocus. As a result, it increases the time taken until an object comesinto focus. Thus, in a case where the number of first areas increases asin FIG. 6B, the camera control unit 114 may perform control so that theamount of shifting is made smaller than in the state of FIG. 6A, therebyshortening the time required to calculate the amount of correlation.Consequently, control is performed so that the time required tocalculate the amount of defocus is equal between, for example, a casewhere the number of first areas is great and a case where the number offirst areas is not great, whereby it is possible to perform stablefocusing such that the responsiveness until focusing is not changed.

Further, generally, in a case where the amount of shifting is madesmaller as described above, when the amount of defocus is great, i.e.,an object is greatly blurred, it is more difficult to detect the amountof defocus than when the amount of defocus is not great. If the amountof defocus cannot be detected, it may take more time until focusing thanin a case where the amount of defocus can be detected. Thus, in a casewhere the amount of defocus cannot be calculated, the camera controlunit 114 may perform control so that the amount of shifting is not madesmaller even in a case where the number of first areas is great, wherebythe time until focusing does not differ. In this case, if the amount ofdefocus that can be calculated in a case where the amount of shifting ismade smaller is calculated, the amount of shifting is made smaller.

Further, in the first to third exemplary embodiments, in a case wherefocus detection signals are read from a partial area of the image sensor106, the higher the frame rate, the narrower the reading band. Thus, ina case where the frame rate is high, the second number of rows in whichfocus detection signals can be read is smaller than in a case where theframe rate is low. That is, the higher the frame rate, the more likelythe assumed in the first to third exemplary embodiments arises. Thus,according to the frame rate, the camera control unit 114 may determinewhether to carry out the first to third exemplary embodiments. Forexample, if the frame rate is so low that it can be determined that thesecond number of rows in which focus detection signals can be read issufficiently great (a second frame rate), the processing of the first tothird exemplary embodiments may not be performed on the assumption thatthe assumed in the first to third exemplary embodiments is less likelyto arise. In this case, in a case where the frame rate is a first framerate higher than the second frame rate, the processing of the first tothird exemplary embodiments is performed.

Further, in the first to third exemplary embodiments, in a case wherethe frame rate is high, the third number of rows may be made smallerthan in a case where the frame rate is low.

Further, the second number of rows may be represented by a proportion toall the number of rows in the column direction of the imaging area ofthe image sensor 106, and according to this proportion, it may bedetermined whether the above control is to be performed. For example, ina case where the second number of rows is in a predetermined proportionto all the number of rows, it is determined that the above control isnot to be performed. The predetermined proportion may be determinedbased on the number of rows that allows phase difference detection areasto be placed at predetermined intervals in a case where the first areais set to be continuous by a predetermined number of pixels. Forexample, if the number of rows in the column direction of pixels forfocus detection that can be set allows the reading of 20% of all thenumber of rows in the column direction, the above control is notperformed.

Further, in the first to third exemplary embodiments, if the size of thesecond area does not become equal to or larger than a predetermined sizein the column direction, and the size of the first area is equal to orlarger than a size in the column direction that can be tolerated interms of the illuminance of an object and the S/N ratio, the sizes inthe column direction of a plurality of first areas may be varied in thefocus detection area. As an example, the size in the column direction ofa first area close to the center of the focus detection area may belarger than that of a first area that is not close to the center of thefocus detection area.

In the above exemplary embodiment, as an example, a case has beenillustrated where the camera control unit 114 performs control based onthe detection result of the AF signal processing unit 113 outside theimage sensor 106. Alternatively, the image sensor 106 may include acomponent corresponding to the AF signal processing unit 113 and acomponent corresponding to the camera control unit 114. Consequently,for example, a laminated sensor can also achieve the invention of theabove exemplary embodiments.

Further, in the exemplary embodiments, a description has been givenusing an example where each pixel includes a microlens and a pair ofphotoelectric conversion units, and the photoelectric conversion unitsreceive light from different lens pupils. The present invention,however, is not limited to such a configuration. For example, theconfiguration may be such that each pixel includes a microlens and asingle photoelectric conversion unit placed behind the microlens, andsome pixels and other pixels receive light from different lens pupils.

Further, the configuration may be such that focus detection signals areobtained by detecting high-frequency components from signals obtainedfrom respective rows. In this case, a selection may be made about whichrow a high-frequency component is to be detected from.

Embodiment(s) of the present invention can also be realized by acomputer of a system or apparatus that reads out and executes computerexecutable instructions (e.g., one or more programs) recorded on astorage medium (which may also be referred to more fully as a‘non-transitory computer-readable storage medium’) to perform thefunctions of one or more of the above-described embodiment(s) and/orthat includes one or more circuits (e.g., application specificintegrated circuit (ASIC)) for performing the functions of one or moreof the above-described embodiment(s), and by a method performed by thecomputer of the system or apparatus by, for example, reading out andexecuting the computer executable instructions from the storage mediumto perform the functions of one or more of the above-describedembodiment(s) and/or controlling the one or more circuits to perform thefunctions of one or more of the above-described embodiment(s). Thecomputer may comprise one or more processors (e.g., central processingunit (CPU), micro processing unit (MPU)) and may include a network ofseparate computers or separate processors to read out and execute thecomputer executable instructions. The computer executable instructionsmay be provided to the computer, for example, from a network or thestorage medium. The storage medium may include, for example, one or moreof a hard disk, a random-access memory (RAM), a read only memory (ROM),a storage of distributed computing systems, an optical disk (such as acompact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™),a flash memory device, a memory card, and the like.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application No.2016-109444, filed May 31, 2016, which is hereby incorporated byreference herein in its entirety.

What is claimed is:
 1. An imaging apparatus comprising: an image sensorincluding a pair of photoelectric conversion units for each of aplurality of microlenses arranged in a matrix of rows and columns, andcapable of reading a signal from each row; a memory storing a program;and one or more processors which, by executing the program, function aseach unit comprising: a reading control unit configured to performcontrol so that a plurality of first areas each having a firstpredetermined number of rows in which signals used for focus detectionare read when signals are read from the image sensor, and a plurality ofsecond areas each having a second predetermined number of rows in whichsignals for use in focus detection are not read, are set by arrangingeach first area alternately with each second area on the image sensor;and a calculation unit configured to calculate an amount of correlationusing, among signals read by a first reading control for reading signalsfor use in focus detection, a pair of focus detection signals obtainedfrom an area on the image sensor corresponding to a set focus detectionarea, wherein, in a case where a second focus detection area larger in acolumn direction than a first focus detection area is set withoutchanging the number of rows in which signals are read from the imagesensor by the first reading control, the reading control unit makes thenumber of the first areas larger than in a case where the first focusdetection area is set, and reduces the number of rows in which signalsare read by the first reading control in each of the first areas,thereby making the first area smaller in the column direction than inthe case where the first focus detection area is set.
 2. The imagingapparatus according to claim 1, wherein a first number of rows, which isthe number of rows of a focus detection area, is less than or equal to athird number of rows in the case of the first focus detection area andis greater than the third number of rows in the case of the second focusdetection area, and wherein the third number of rows is the number ofrows based on a second number of rows, which is the number of rows inwhich signals are read by the first reading control.
 3. The imagingapparatus according to claim 1, wherein in a case where a focusdetection area is smaller than the first focus detection area, thenumber of the first areas and the number of rows in which signals areread by the first reading control in each of the first areas are thesame as a case of the first focus detection area.
 4. The imagingapparatus according to claim 1, wherein the image sensor includes apixel portion including the pair of photoelectric conversion unitscorresponding to each of the plurality of microlenses, and wherein theone or more processors, by executing the program, further function as asignal addition control unit configured to control addition of signalsread by the first reading control in each of the first areas.
 5. Theimaging apparatus according to claim 4, wherein the calculation unitcalculates an amount of correlation of each of the first areas using asignal obtained by the addition corresponding to the first area andperforms focus detection using an added amount of correlation obtainedby adding together the amounts of correlation calculated from theplurality of respective first areas in the focus detection area.
 6. Theimaging apparatus according to claim 5, wherein in a case where thereading control unit increases the number of the first areas and reducesthe number of rows in which signals are read by the first readingcontrol in each of the first areas, thereby making the first areasmaller in the column direction, and when the calculation unitcalculates the amount of correlation by shifting the signal obtained bythe addition, the reading control unit reduces an amount of theshifting.
 7. The imaging apparatus according to claim 1, wherein in acase where illuminance of an object is lower than a predetermined value,and even in a case where the second focus detection area larger in thecolumn direction than the first focus detection area is set, the readingcontrol unit does not increase the number of rows in which signals areread by the first reading control in each of the first areas, and a sizein the column direction of the first area is the same.
 8. The imagingapparatus according to claim 1, wherein in a case where a frame rate ofthe image sensor is a second frame rate lower than a first frame rate,the number of the first areas and the number of rows in which signalsare read by the first reading control in each of the first areas are notvaried from a case of the first frame rate, without changing the numberof rows in which signals are read from the image sensor by the firstreading control, regardless of a size in the column direction of thefocus detection area.
 9. The imaging apparatus according to claim 8,wherein in a case where a frame rate of the image sensor is the firstframe rate, and in a case where the second focus detection area is set,then without changing the number of rows in which signals are read fromthe image sensor by the first reading control, the number of the firstareas is made larger than in the case where the first focus detectionarea is set, and the number of rows in which signals are read by thefirst reading control in each of the first areas is reduced to make thefirst area smaller in the column direction than in the case where thefirst focus detection area is set.
 10. An imaging apparatus comprising:an image sensor including a pair of photoelectric conversion units foreach of a plurality of microlenses arranged in a matrix of rows andcolumns, and capable of reading a signal from each row; a memory storinga program; and one or more processors which, by executing the program,function as each unit comprising: a reading control unit configured toperform control so that a plurality of first areas, each having a firstpredetermined number of rows in which signals are read by first readingcontrol for reading signals for use in focus detection when signals areread from the image sensor, and a plurality of second areas, each havinga second predetermined number of rows in which signals are read withoutperforming the first reading control as, are set by arranging each firstarea alternately with each second area on the image sensor; and acalculation unit configured to calculate an amount of correlation using,among the signals read by the first reading control, a pair of focusdetection signals obtained from an area on the image sensorcorresponding to a set focus detection area, wherein the number of thefirst areas and a size of each first area set by the reading controlunit in a case where a size of the focus detection area is a first sizeand the number of the first areas and a size of each first area set bythe reading control unit in a case where a size of the focus detectionarea is a second size different from the first size are different. 11.The imaging apparatus according to claim 10, wherein in a case where thesecond area is larger than the predetermined size in the columndirection, the first area is larger in the column direction and thenumber of the first areas is greater than in a case where the secondarea is less than or equal to the predetermined size.
 12. The imagingapparatus according to claim 10, wherein in a case where the second areais larger than the predetermined size in the column direction, the focusdetection area is larger in the column direction than the number of rowsin which signals are read by the first reading control.
 13. The imagingapparatus according to claim 12, wherein in a case where illuminance ofan object is lower than a predetermined value, and even in a case wherethe second area is equal to or larger than the predetermined size in thecolumn direction, the reading control unit does not increase the numberof rows in which signals are read by the first reading control in eachof the first areas, and a size in the column direction of the first areais the same.
 14. The imaging apparatus according to claim 10, wherein ina case where the second area is larger than the predetermined size inthe column direction, the second area is larger than the first area. 15.The imaging apparatus according to claim 10, wherein the image sensorincludes a pixel portion including the pair of photoelectric conversionunits corresponding to each of the plurality of microlenses, and whereinthe one or more processors, by executing the program, further functionas a signal addition control unit configured to control addition ofsignals read by the first reading control in each of the first areas.16. The imaging apparatus according to claim 15, wherein the calculationunit calculates an amount of correlation of each of the first areasusing an image signal obtained by the addition corresponding to thefirst area and performs focus detection using an added amount ofcorrelation obtained by adding together the amounts of correlationcalculated from the plurality of respective first areas in the focusdetection area.
 17. The imaging apparatus according to claim 16, whereinin a case where each first area is large in the column direction, andthe number of the first areas is set to be great, and when thecalculation unit calculates the amount of correlation by shifting thesignal obtained by the addition, the reading control unit reduces anamount of the shifting.
 18. The imaging apparatus according to claim 10,wherein in a case where a frame rate of the image sensor is a secondframe rate lower than a first frame rate, the number of the first areasand the number of rows in which signals are read by the first readingcontrol in each of the first areas are not varied from a case of thefirst frame rate, without changing the number of rows in which signalsare read from the image sensor by the first reading control, regardlessof a size in the column direction of the focus detection area.
 19. Theimaging apparatus according to claim 18, wherein in a case where theframe rate of the image sensor is the first frame rate, and in a casewhere the second focus detection area is set, then without changing thenumber of rows in which signals are read from the image sensor by thefirst reading control, the number of the first areas is made larger thanin the case where the first focus detection area is set, and the numberof rows in which signals are read by the first reading control in eachof the first areas is reduced to make the first area smaller in thecolumn direction than in the case where the first focus detection areais set.
 20. A method for controlling an imaging apparatus including animage sensor including a pair of photoelectric conversion units for eachof a plurality of microlenses arranged in a matrix of rows and columns,and capable of reading a signal from each row, the method comprising:performing control so that a plurality of first areas, each having afirst predetermined number of rows in which signals for use in focusdetection are read when signals are read from the image sensor, and aplurality of second areas, each having a second predetermined number ofrows in which signals for use in focus detection are not read, are setby arranging each first area alternately with each second area on theimage sensor; and performing phase difference focus detection using,among signals read by first reading control for reading signals for usein focus detection, a pair of focus detection signals obtained from anarea on the image sensor corresponding to a set focus detection area,wherein in a case where a second focus detection area larger in a columndirection than a first focus detection area is set without changing thenumber of rows in which signals are read from the image sensor by thefirst reading control, the number of the first areas is made larger thanin a case where the first focus detection area is set, and the number ofrows in which signals are read by the first reading control in each ofthe first areas is reduced, thereby making the first area smaller in thecolumn direction than in the case where the first focus detection areais set.
 21. A method for controlling an imaging apparatus including animage sensor including a pair of photoelectric conversion units for eachof a plurality of microlenses arranged in a matrix of rows and columns,and capable of reading a signal from each row, the method comprising:performing control so that a plurality of first areas, each having afirst predetermined number of rows in which signals are read by firstreading control for reading signals for use in focus detection whensignals are read from the image sensor, and a plurality of second areas,each having a second predetermined number of rows in which signals areread without performing the first reading control, are set by arrangingeach first area alternately with each second area on the image sensor;and performing calculation of an amount of correlation using, among thesignals read by the first reading control, a pair of focus detectionsignals obtained from an area on the image sensor corresponding to a setfocus detection area, wherein the number of the first areas and a sizeof each first area set by the reading control unit in a case where asize of the focus detection area is a first size and the number of thefirst areas and a size of each first area set by the reading controlunit in a case where a size of the focus detection area is a second sizedifferent from the first size are different.